#!/bin/bash
function generate(){
    /usr/bin/expect -c"
    set timeout 30
    spawn ssh-keygen -t rsa
    expect \":\"
    send \"\r\"
    expect \":\"
    send \"\r\"
    expect \":\"
    send \"\r\"
    expect eof
    exit
    "
}
if [ ! -d ~/.ssh ];then
    generate
    if [ $? != 0 ];then
        echo "create rsa failed! xxxxxx"
        exit 0
    fi
else 
    echo $(cd ~;pwd)"/.ssh exists!"
fi
